<%-- 
    Document   : mostrarhorarios
    Created on : 25-jun-2013, 21:38:07
    Author     : davidcabrera
--%>
<%@page import="negocio.Horario"%>
<%@taglib uri="http://struts.apache.org/tags-logic" prefix="logic"%>
<%@taglib uri="http://struts.apache.org/tags-bean" prefix="bean"%>
<%@taglib uri="http://struts.apache.org/tags-html" prefix="html"%>
<%@page import="java.util.ArrayList"%>
<%@page import="negocio.Pista"%>
<%@page import="javax.swing.text.Document"%>
<%@page import="negocio.Instalacion"%>
<%@page import="java.util.List"%>
<%@page import="negocio.dao.DAO"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<head>
    <title>Horario</title>
    <meta charset="utf-8">
    <link rel="stylesheet" type="text/css" media="screen" href="css/reset.css">
    <link rel="stylesheet" type="text/css" media="screen" href="css/style.css">
    <link rel="stylesheet" type="text/css" media="screen" href="css/grid_12.css">
    <script src="js/jquery-1.7.min.js"></script>
    <script src="js/jquery.easing.1.3.js"></script>
    <script src="js/cufon-yui.js"></script>
    <script src="js/Asap_400.font.js"></script>
    <script src="js/Coolvetica_400.font.js"></script>
    <script src="js/Kozuka_M_500.font.js"></script>
    <script src="js/cufon-replace.js"></script>
    <script src="js/FF-cash.js"></script>

</head>
<body>
    <div class="main">
        <div class="bg-img"></div>
        <!--==============================header=================================-->
          <header>
                <h1><a href="index.jsp">Sport <strong>Club</strong></a></h1>

                <div style="margin-top: 30px; margin-left: 750px">        

                </div> 
                <div >
                    
                <logic:empty name="usuario" scope="session">
                        <html:form action="/login" >
                            <div>
                            <table border="0" class="login-form">
                                <tbody>
                                    <tr>
                                        <td><strong>Email:</strong></td>
                                        <td><html:text property="email" name="LoginForm" style="text-align:right"/></td>
                                    </tr>
                                    <tr>
                                        <td><strong>Clave:</strong></td>
                                        <td><html:password property="pass" name="LoginForm" style="text-align:right"/></td>
                                    </tr>
                                    <tr>
                                        <td colspan="2" class="button" style="text-align:right;"><html:submit value="Login"/></td>
                                    </tr>
                                    <tr>
                                        <td colspan="2" style="text-align:right"><a href="registro.jsp" class="color-1">¡Registrate!</a></td>
                                    </tr>

                                </tbody>
                            </table>
                                    </div>
                        </html:form>
                    </logic:empty>
                        
                        <logic:notEmpty name="usuario" scope="session">
                            <div style="text-align: right" >
                            Bienvenido, <strong><a class="link" href="cuenta.do"><bean:write name="usuario" property="nombre"/></a></strong>

                            <br/>
                            <a class="link" href="unlogin.do" >Desconectar</a>
                            </div>
                        </logic:notEmpty>
                    
                </div>


                <nav style="clear: both">
                    
                    <ul class="menu">
                        <li><a href="index.jsp">Principal</a></li>
                        <li class="current"><a href="instalaciones.do">Instalaciones</a></li>
                        <li><a href="galeria.jsp">Galeria</a></li>
                        <li><a href="contacta.jsp">Contacta</a></li>
                    </ul>
                </nav>
            </header>   
        <!--==============================content================================-->
        <section id="content">

            <div class="container_12">
                <div class="grid_12">
                    <div class="box-shadow">
                        <div class="wrap block-2">
                            <!-- Division izq -->
                            <div class="col-1">
                                <%
                                Pista p=(Pista)request.getAttribute("pista");
                                
                                %>
                                <h2 class="p3"><span class="color-1">Horario</span> <%= p.getNombre() %></h2>
                                <%
                                    ArrayList ocupado = (ArrayList) request.getAttribute("ocupado");
                                    List<Horario> horario = (List<Horario>) request.getAttribute("horarios");
                                    String[] dias = {"Lunes", "Martes", "Miercoles", "Jueves", "Viernes", "Sabado"};
                                %>                                                                                              

                                <%

                                    for (int i = 0; i < dias.length; i++) {
                                        if (dias[i] == "Lunes") {
                                %>
                                <div class="wrap box-2 border-1">

                                    <% }
                                        if (dias[i] == "Jueves") {%>

                                </div>
                                <div class="wrap box-2">
                                    <% }
                                        if (dias[i] == "Miercoles" || dias[i] == "Sabado") {%>
                                    <div class="last">
                                        <% } else {%>
                                        <div>
                                            <% }%>
                                            <p><strong><%= dias[i]%></strong></p>
                                            <table>
                                                <%
                                                    for (int j = 0; j < horario.size(); j++) {

                                                        if (dias[i].equals(horario.get(j).getDiaSemana())) {
                                                            if (ocupado.get(j).equals(false)) {%>
                                                <tr>
                                                    <td>
                                                        <form action="reservar.do" method="post">
                                                            <input type="hidden" name="idpista" value="<%= p.getIdPista()%>">
                                                            <input type="hidden" name="idinst" value="<%= p.getIdInstalacion()%>">
                                                            <input type="hidden" name="idhorario" value="<%= horario.get(j).getIdHorario() %>">
                                                            <a onclick="submit()" class="button2"><%= horario.get(j).getHoraInicio().toString().substring(0, 5)%></a>
                                                        </form>
                                                       
                                                    
                                                    </td>
                                                </tr>
                                                <% } else {%>
                                                <tr>
                                                    <td><p class="button2"><%= horario.get(j).getHoraInicio().toString().substring(0, 5) %></p></td>
                                                </tr>
                                                <% }
                                                    }%>


                                                <% }%>
                                            </table>

                                        </div>

                                        <%                                        }
                                        %>
                                    </div>
                                    <!--
                                        <div>
                                            <p><strong>Martes</strong></p>
                                            <p class="color-1">10:00</p>
                                            <p>Consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore.</p>
                                        </div>
                                        <div class="last">
                                            <p><strong>Miercoles</strong></p>
                                            <p class="color-1">9:30</p>
                                            <p>Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat.</p>
                                        </div>
                                    </div>
                                    <div class="wrap box-2">
                                        <div>
                                            <p><strong>Jueves</strong></p>
                                            <p class="color-1">9:30</p>
                                            <p>Imperdiet doming id quod mazim placerat facer possim assum lorem ipsum dolor sit amet.</p>
                                        </div>
                                        <div>
                                            <p><strong>Viernes</strong></p>
                                            <p class="color-1">9:30</p>
                                            <p>Imperdiet doming id quod mazim placerat facer possim assum lorem ipsum dolor sit amet.</p>
                                        </div>
                                        <div class="last">
                                            <p><strong>Sabado</strong></p>
                                            <p class="color-1">9:30</p>
                                            <p>Imperdiet doming id quod mazim placerat facer possim assum lorem ipsum dolor sit amet.</p>
                                        </div>
                                    </div>
                                    -->
                                </div>
                            </div>
                                    
                        </div>

                                    
                    </div>
                </div>
                <div class="clear"></div>

        </section> 
        <!--==============================footer=================================-->
    </div>
    <%@include file="footer.jsp" %>
</body>
</html>
